package edu.hitsz.aircraft;

import edu.hitsz.application.Main;
import edu.hitsz.factory.prop.BloodPropFactory;
import edu.hitsz.factory.prop.BombPropFactory;
import edu.hitsz.factory.prop.BulletPropFactory;
import edu.hitsz.prop.AbstractProp;
import edu.hitsz.shoot.ShootScatteringByEnemy;

import java.util.Random;


/**
 * BOSS战机类：
 * @author Hmount
 */
public class BossAircraft extends AbstractAircraft{


    public BossAircraft(int locationX, int locationY, int speedX, int speedY, int hp) {
        super(locationX, locationY, speedX, speedY, hp);
        this.type = 3;
        this.shootStrategy = new ShootScatteringByEnemy();
        this.shootNum = 3;
        this.power =5;
        this.direction = 1;
    }

    @Override
    public void forward() {
        super.forward();
        // 判定 y 轴向下飞行出界
        if (locationY >= Main.WINDOW_HEIGHT ) {
            vanish();
        }
    }


    @Override
    public AbstractProp dropProp() {
        Random r = new Random();

        int choice = r.nextInt(3);
        AbstractProp newProp = null;

        if (choice == 0) {
            newProp = new BloodPropFactory().createProp(
                    this.locationX,
                    this.locationY,
                    0,
                    10
            );
        } else if (choice == 1) {
            newProp = new BombPropFactory().createProp(
                    this.locationX,
                    this.locationY,
                    0,
                    10);
        } else if (choice == 2) {
            newProp = new BulletPropFactory().createProp(
                    this.locationX,
                    this.locationY,
                    0,
                    10);
        }
        return newProp;
    }


}
